using Castle.DynamicProxy;

namespace DynamicProxy;
//三。创建代理工厂
public class ProxyGeneratorFactory
{
    private static readonly ProxyGenerator _generator = new ProxyGenerator();
    public static T CreateProxy<T>(T target) where T : class
    {
        return _generator.CreateInterfaceProxyWithTarget(
            target, 
            new LoggingInterceptor());
    }
}